<!DOCTYPE html>
<html lang="zh-CN">

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
<title>面向研究团队的参考文献管理与服务分布式系统</title>

<!-- Bootstrap -->
<link href="css/bootstrap.css" rel="stylesheet">
<!--内部样式-->
<style type="text/css">
p {
	text-align: justify;
	text-indent: 32px;
	font-size: 16px;
	margin-right: 15px;
	line-height: 24px;
	color: #000000;
}
</style>
<script src="js/angular.min.js"></script>
<script src="js/angular-cookies.min.js"></script>

</head>

<body>
	<div class="container">
		<div class="row" style="background-color: #005BAC; height: 130px;">
			<div style="line-height: 130px;" class="col-md-4">
				<img src="images/logo.png">
			</div>
			<div
				style="line-height: 130px;color: white;font-size:28px;font-family: '微软雅黑';"
				class="col-md-8">面向研究团队的参考文献管理与服务分布式系统</div>
		</div>
		<div
			style="height:35px;background-color:#C6DEEB;border: 1px solid darkgrey;align:center;"
			class="row">
			<p
				style="text-align: center;line-height: 35px;text-indent:0px;margin-left:5px;font-size: 16px;color: #0066B3;font-family: '微软雅黑';font-weight:bold;">团队管理员或独立用户注册信息</p>
		</div>
		<div class="row " style="border:1px solid #C6DEEB">
			<div class="col-md-2">
				<label>选择是否是独立用户</label>
			</div>
			<div class=" col-md-2">
				<label> <input type="radio" name="optionsRadios"
					id="optionsRadios1" value="option1">独立用户
				</label>
			</div>
			<div class=" col-md-2">
				<label> <input type="radio" name="optionsRadios"
					id="optionsRadios2" value="option2" checked>团队用户
				</label>
			</div>
			<div class="col-md-6" style="padding:0px">选择个人用户时，不需要也不能录入任何团队信息；团队管理员需要其个人信息与团队信息
			</div>
		</div>
		<div style="border: 1px solid darkgrey;" class="row">
			<div class="col-md-6" style="border:1px solid #C6DEEB">
				<div class="col-md-1"></div>
				<div class="col-md-11">
					<div class="form-group"
						style="background-color:#eea200;color:white;width:60%;top:4px;position:relative;">
						<span style="margin-left:20px;font-size:large">注册团队信息</span>
					</div>
					<div class="row">
						<div class="col-xs-5">
							<div class="form-group  has-feedback">
								<label>团&nbsp;&nbsp;队&nbsp;&nbsp;号:&nbsp;</label>
								<div class="input-group" style="width:100%">
									<input id="teamno" class="form-control" maxlength="10"
										type="text" onblur="checkteamno()"
										onfocus="clearScreen('emailErr1')">
								</div>
							</div>
						</div>
						<div class="col-xs-5 text-center"
							style="font-size:5px;padding:32px 0px 0px 0px">
							团队号必须为10位数字和字母组合</div>
						<div class="col-xs-2 text-center"
							style="color:red;font-size:5px;padding:32px 0px 0px 0px">
							<div id="emailErr1" class="errTxt"></div>
						</div>
					</div>
					<div class="row">
						<div class="col-xs-5">
							<div class="form-group   has-feedback">
								<label for="teamname">团&nbsp;&nbsp;队&nbsp;&nbsp;名:&nbsp;</label>
								<div class="input-group" style="width:100%">
									<input id="teamname" class="form-control" maxlength="20"
										type="text" onblur="checkteamname()"
										onfocus="clearScreen('emailErr2')">
								</div>
							</div>
						</div>
						<div class="col-xs-5 text-center"
							style="font-size:5px;padding:32px 0px 0px 0px">团队名必须为1~20位汉字组合</div>
						<div class="col-xs-2 text-center"
							style="color:red;font-size:5px;padding:32px 0px 0px 0px">
							<div id="emailErr2" class="errTxt"></div>
						</div>
					</div>
					<!-- <div class="row">
						<div class="col-xs-5">
							<div class="form-group   has-feedback">
								<label for="teamemail">团队Email:</label>
								<div class="input-group" style="width:100%">
									<input id="teamemail" class="form-control" maxlength="20"
										type="text" onblur="checkemail()"
										onfocus="clearScreen('emailErr3')">
								</div>
							</div>
						</div>
						<div class="col-xs-5 text-center"
							style="font-size:5px;padding:32px 0px 0px 0px">
							邮箱格式:xxxx@xx.xx</div>
						<div class="col-xs-2 text-center"
							style="color:red;font-size:5px;padding:32px 0px 0px 0px">
							<div id="emailErr3" class="errTxt"></div>
						</div>
					</div> -->
					<div class="row">
						<div class="col-xs-5">
							<div class="form-group   has-feedback">
								<label for="max">最大用户数:</label>
								<div class="input-group" style="width:100%">
									<input id="max" class="form-control" maxlength="6" type="text"
										onblur="checkmax()" onfocus="clearScreen('emailErr4')">
								</div>
							</div>
						</div>
						<div class="col-xs-5 text-center"
							style="font-size:5px;padding:32px 0px 0px 0px">
							请输入1~100范围内数字</div>
						<div class="col-xs-2 text-center"
							style="color:red;font-size:5px;padding:32px 0px 0px 0px">
							<div id="emailErr4" class="errTxt"></div>
						</div>
					</div>
					<div class="row">
						<div class="col-xs-5">
							<div class="form-group has-feedback">
								<label for="idcode-btn">校验码</label>
								<div class="input-group" style="width:100%">
									<input id="idcode-btn" class="form-control" maxlength="6"
										type="text">
								</div>
								<span style="color:red;display: none;" class="tips"></span> <span
									style="display: none;"
									class="glyphicon glyphicon-remove form-control-feedback"></span>
								<span style="display: none;"
									class="glyphicon glyphicon-ok form-control-feedback"></span>
							</div>
						</div>
						<div class="col-xs-5 text-center" style="padding-top: 26px">
							<button type="button" id="loadingButton" class="btn btn-primary"
								autocomplete="off">获取管理员邮箱校验码</button>
						</div>
					</div>

				</div>
			</div>
			<div class="col-md-6" style="border:1px solid #C6DEEB">
				<div class="col-md-1"></div>
				<div class="col-md-11">

					<div class="form-group"
						style="background-color:#eea200;width:60%;color:white;top:4px;position:relative;">
						<span style="margin-left:20px;font-size:large">团队管理员或独立用户信息</span>
					</div>
					<div class="row">
						<div class="col-xs-5">
							<div class="form-group  has-feedback">
								<label for="userno">用&nbsp;&nbsp;户&nbsp;&nbsp;号:&nbsp;</label>
								<div class="input-group" style="width:100%">
									<input id="userno" class="form-control" maxlength="10"
										type="text" onblur="checkUserNo()"
										onfocus="clearScreen('emailErr6')">
								</div>
							</div>
						</div>
						<div class="col-xs-5 text-center"
							style="font-size:5px;padding:32px 0px 0px 0px">
							用户号必须为10位数字和字母组合</div>
						<div class="col-xs-2 text-center"
							style="color:red;font-size:5px;padding:32px 0px 0px 0px">
							<div id="emailErr6" class="errTxt"></div>
						</div>
					</div>
					<div class="row">
						<div class="col-xs-5">
							<div class="form-group   has-feedback">
								<label for="username">用&nbsp;&nbsp;户&nbsp;&nbsp;名:&nbsp;</label>
								<div class="input-group" style="width:100%">
									<input id="username" class="form-control" maxlength="10"
										type="text" onblur="checkusername()"
										onfocus="clearScreen('emailErr9')">
								</div>
							</div>
						</div>
						<div class="col-xs-5 text-center"
							style="font-size:5px;padding:32px 0px 0px 0px">用户名不超过十位</div>
						<div class="col-xs-2 text-center"
							style="color:red;font-size:5px;padding:32px 0px 0px 0px">
							<div id="emailErr9" class="errTxt"></div>
						</div>
					</div>

					<div class="row">
						<div class="col-xs-5">
							<div class="form-group   has-feedback">
								<label for="password">密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码:&nbsp;</label>
								<div class="input-group" style="width:100%">
									<input id="password" class="form-control" maxlength="9"
										type="password" onblur="checkpas()"
										onfocus="clearScreen('emailErr7')">
								</div>
							</div>
						</div>
						<div class="col-xs-5 text-center"
							style="font-size:5px;padding:32px 0px 0px 0px">
							密码必须为6~9位数字和字母组合</div>
						<div class="col-xs-2 text-center"
							style="color:red;font-size:5px;padding:32px 0px 0px 0px">
							<div id="emailErr7" class="errTxt"></div>
						</div>
					</div>
					<div class="row">
						<div class="col-xs-5">
							<div class="form-group   has-feedback">
								<label for="password2">确&nbsp;认&nbsp;密&nbsp;码:</label>
								<div class="input-group" style="width:100%">
									<input id="password2" class="form-control" maxlength="9"
										type="password" onblur="checkpas2()"
										onfocus="clearScreen('emailErr10')">
								</div>
							</div>
						</div>
						<div class="col-xs-5 text-center"
							style="font-size:5px;padding:32px 0px 0px 0px">密码需和第一次输入相同</div>
						<div class="col-xs-2 text-center"
							style="color:red;font-size:5px;padding:32px 0px 0px 0px">
							<div id="emailErr10" class="errTxt"></div>
						</div>
					</div>
					<div class="row">
						<div class="col-xs-5">
							<div class="form-group   has-feedback">
								<label for="phoneNum">手&nbsp;机&nbsp;号&nbsp;码:</label>
								<div class="input-group" style="width:100%">
									<input id="phoneNum" class="form-control" maxlength="11"
										type="text" onblur="checkTel()"
										onfocus="clearScreen('emailErr5')">
								</div>
							</div>
						</div>
						<div class="col-xs-5 text-center"
							style="font-size:5px;padding:32px 0px 0px 0px">请输入11位数字</div>
						<div class="col-xs-2 text-center"
							style="color:red;font-size:5px;padding:32px 0px 0px 0px">
							<div id="emailErr5" class="errTxt"></div>
						</div>
					</div>
					<div class="row">
						<div class="col-xs-5">
							<div class="form-group   has-feedback">
								<label for="phoneNum">用户Email:</label>
								<div class="input-group" style="width:100%">
									<input id="userEmail" class="form-control" maxlength="20"
										type="text" onblur="checkuseremail()"
										onfocus="clearScreen('emailErr8')">
								</div>
							</div>
						</div>
						<div class="col-xs-5 text-center"
							style="font-size:5px;padding:32px 0px 0px 0px">
							邮箱格式必须为xxxxx@xx.xx</div>
						<div class="col-xs-2 text-center"
							style="color:red;font-size:5px;padding:32px 0px 0px 0px">
							<div id="emailErr8" class="errTxt"></div>
						</div>
					</div>

				</div>
			</div>
		</div>
		<div class="row" style="text-align: center;border:1px solid #C6DEEB;">
			<div class="form-group  form-inline"
				style="top:4px;position:relative;">
				<input class="form-control btn btn-primary" id="submit" value="注册"
					type="submit" style="width: auto;"> <input value="重置"
					id="reset" class="form-control btn btn-danger" onclick=""
					type="reset" style="width: auto;">
			</div>
		</div>
		<div class="row"
			style="height:100%;border: 0px solid darkgrey;text-align:center;">
			<div class="row"
				style="height:1px;background-color: #004C8F;text-align: center;">
				<p style="height:2px;color: whitesmoke;font-size: 14px;"></p>
			</div>
			<div
				style="color: black;margin-right: 50px;margin-top:20px;font-size: 12px;text-align:center">
				<ul>
					<h>北京交通大学计算机与信息技术学院</h>
					</br>
					<h>云计算与数据科学研究所</h>
					</br>
					<h>北京市海淀区西直门外上园村3号</h>
					</br>
					<h>电话： 51683859&nbsp;&nbsp;&nbsp;&nbsp;邮编：100044</h>
					</br>
				</ul>
			</div>
		</div>


		<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
		<script src="js/jquery-2.0.3.min.js"></script>
		<script src="js/jquery.cookie.js"></script>
		<!-- Include all compiled plugins (below), or include individual files as needed -->
		<script src="js/bootstrap.min.js"></script>
		<script>
			var check1;
			var check2;
			var check3;
			var check4;
			var check5;
			var check6;
			var check7;
			var check8;
			var check9;
			var check10;
			function isTelCode(str) {
				var reg = /^((0\d{2,3}-\d{7,8})|(1[3584]\d{9}))$/;
				return reg.test(str);
			}
			function checkteamno() { //本函数验证团队号是否合法
				var str = document.getElementById('teamno').value;
				//在JavaScript中，正则表达式只能使用"/"开头和结束，不能使用双引号
				var reg = /^[\da-zA-Z]{10}$/;
				if (reg.test(str)) {
					check1 = 1;
					document.getElementById("emailErr1").innerHTML = "<i class='glyphicon glyphicon-ok' style='color:green'></i>";
					return true;
				} else {
					document.getElementById("emailErr1").innerHTML = "<i class='glyphicon glyphicon-remove'></i>";
					return false;
				}
			}
			/* function checkemail() {
				var str = document.getElementById('teamemail').value;
		
				//在JavaScript中，正则表达式只能使用"/"开头和结束，不能使用双引号
				var reg = /^([a-z|A-Z|0-9|_])+@([a-z|A-Z|0-9|_])+\.com|edu|cn|net$/;
				if (reg.test(str)) {
					check3 = 1;
					document.getElementById("emailErr3").innerHTML = "<i class='glyphicon glyphicon-ok' style='color:green'></i>";
					return true;
				} else {
					document.getElementById("emailErr3").innerHTML = "<i class='glyphicon glyphicon-remove'></i>";
					return false;
				}
			} */
			function checkTel() {
				var str = document.getElementById('phoneNum').value;
		
				//在JavaScript中，正则表达式只能使用"/"开头和结束，不能使用双引号
				var reg = /^1\d{10}$/;
				if (reg.test(str)) {
					check5 = 1;
					document.getElementById("emailErr5").innerHTML = "<i class='glyphicon glyphicon-ok' style='color:green'></i>";
					return true;
				} else {
					document.getElementById("emailErr5").innerHTML = "<i class='glyphicon glyphicon-remove'></i>";
					return false;
				}
			}
			function checkmax() {
				var str = document.getElementById('max').value;
		
				//在JavaScript中，正则表达式只能使用"/"开头和结束，不能使用双引号
		
				if (str > 0 && str < 100) {
					check4 = 1;
					document.getElementById("emailErr4").innerHTML = "<i class='glyphicon glyphicon-ok' style='color:green'></i>";
					return true;
				} else {
					document.getElementById("emailErr4").innerHTML = "<i class='glyphicon glyphicon-remove'></i>";
					return false;
				}
			}
			function checkUserNo() {
				var str = document.getElementById('userno').value;
				//在JavaScript中，正则表达式只能使用"/"开头和结束，不能使用双引号
				var reg = /^[\da-zA-Z]{10}$/;
				if (reg.test(str)) {
					check6 = 1;
					document.getElementById("emailErr6").innerHTML = "<i class='glyphicon glyphicon-ok' style='color:green'></i>";
					return true;
				} else {
					document.getElementById("emailErr6").innerHTML = "<i class='glyphicon glyphicon-remove'></i>";
					return false;
				}
			}
			function checkpas() {
				var str = document.getElementById('password').value;
				//在JavaScript中，正则表达式只能使用"/"开头和结束，不能使用双引号
				var reg = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,9}$/;
				if (reg.test(str)) {
					check7 = 1;
					document.getElementById("emailErr7").innerHTML = "<i class='glyphicon glyphicon-ok' style='color:green'></i>";
					return true;
				} else {
					document.getElementById("emailErr7").innerHTML = "<i class='glyphicon glyphicon-remove'></i>";
					return false;
				}
			}
			function checkuseremail() {
				var str = document.getElementById('userEmail').value;
				//在JavaScript中，正则表达式只能使用"/"开头和结束，不能使用双引号
				var reg = /^([a-z|A-Z|0-9|_])+@([a-z|A-Z|0-9|_])+\.com|edu|cn|net$/;
				if (reg.test(str)) {
					check8 = 1;
					document.getElementById("emailErr8").innerHTML = "<i class='glyphicon glyphicon-ok' style='color:green'></i>";
					return true;
				} else {
					document.getElementById("emailErr8").innerHTML = "<i class='glyphicon glyphicon-remove'></i>";
					return false;
				}
			}
			function checkteamname() {
				var str = document.getElementById('teamname').value;
				//在JavaScript中，正则表达式只能使用"/"开头和结束，不能使用双引号
				var reg = /^[\u4e00-\u9fa5 ]{1,20}$/;
				if (reg.test(str)) {
					check2 = 1;
					document.getElementById("emailErr2").innerHTML = "<i class='glyphicon glyphicon-ok' style='color:green'></i>";
					return true;
				} else {
					document.getElementById("emailErr2").innerHTML = "<i class='glyphicon glyphicon-remove'></i>";
					return false;
				}
			}
			function checkusername() {
				var str = document.getElementById('username').value;
				//在JavaScript中，正则表达式只能使用"/"开头和结束，不能使用双引号
				/* var reg = /^[\u4e00-\u9fa5 ]{2,20}$/; */
				var reg = /^[0-9a-zA-Z\u4e00-\u9fa5_]{1,10}$/;
				if (reg.test(str)) {
					check9 = 1;
					document.getElementById("emailErr9").innerHTML = "<i class='glyphicon glyphicon-ok' style='color:green'></i>";
					return true;
				} else {
					document.getElementById("emailErr9").innerHTML = "<i class='glyphicon glyphicon-remove'></i>";
					return false;
				}
			}
			function checkpas2() { //本函数二次验证密码
				var str = document.getElementById('password2').value;
				var str1 = document.getElementById('password').value;
				//在JavaScript中，正则表达式只能使用"/"开头和结束，不能使用双引号
				if (str == str1) {
					check10 = 1;
					document.getElementById("emailErr10").innerHTML = "<i class='glyphicon glyphicon-ok' style='color:green'></i>";
					return true;
				} else {
					document.getElementById("emailErr10").innerHTML = "<i class='glyphicon glyphicon-remove'></i>";
					return false;
				}
			}
			function clearScreen(nameval) {
				document.getElementById(nameval).style = "none";
				document.getElementById(nameval).innerHTML = "";
			}
			$('#submit').click(function(e) {
				if (check1 && check2 && check4 && check5 && check6 && check7 && check8 && check9 && check10) {
					var userno = $("#userno").val();
					var username = $("#username").val();
					var password = $("#password").val();
					var phonenum = $("#phoneNum").val();
					var userEmail = $("#userEmail").val();
					var max = $("#max").val();
					var teamno = $("#teamno").val();
					var teamname = $("#teamname").val();
					/* var teamemail = $("#teamemail").val(); */
					var userRole = "c";
					if (max == 1) {
						teamno = userno;
						userRole = "b";
					}
					$.ajax({
						type : "Post",
						contentType : "application/json",
						data : '{"userNo":"' + userno + '","userName":"' + username + '","password":"' + password + '","userPhone":"' + phonenum + '","userEmail":"' + userEmail + '","maxNum":"' + max + '","teamNo":"' + teamno + '","teamName":"' + teamname + '","userTeamNo":"' + teamno + '","userRole":"' + userRole + '"}',
						dataType : 'json',
						url : '/ma/user/insert',
						success : function(data) {
							alert("注册成功,等待系统管理员审核，请注意查收邮件通知!");
							window.location.href = 'index.html';			
						}
					});
		
				} else {
					alert("注册失败！");
					document.getElementById("userno").value = "";
					document.getElementById("username").value = "";
					document.getElementById("password").value = "";
					document.getElementById("password2").value = "";
					document.getElementById("phoneNum").value = "";
					document.getElementById("userEmail").value = "";
					document.getElementById("teamno").value = "";
					document.getElementById("teamname").value = "";
					/* document.getElementById("teamemail").value = ""; */
					document.getElementById("max").value = "";
					document.getElementById("emailErr1").innerHTML = "";
					document.getElementById("emailErr2").innerHTML = "";
					/* document.getElementById("emailErr3").innerHTML = ""; */
					document.getElementById("emailErr4").innerHTML = "";
					document.getElementById("emailErr5").innerHTML = "";
					document.getElementById("emailErr6").innerHTML = "";
					document.getElementById("emailErr7").innerHTML = "";
					document.getElementById("emailErr8").innerHTML = "";
					document.getElementById("emailErr9").innerHTML = "";
					document.getElementById("emailErr10").innerHTML = "";
				}
			});
			$('#reset').click(function(e) {
				document.getElementById("userno").value = "";
				document.getElementById("username").value = "";
				document.getElementById("password").value = "";
				document.getElementById("password2").value = "";
				document.getElementById("phoneNum").value = "";
				document.getElementById("userEmail").value = "";
				document.getElementById("teamno").value = "";
				document.getElementById("teamname").value = "";
				/* document.getElementById("teamemail").value = ""; */
				document.getElementById("max").value = "";
				document.getElementById("emailErr1").innerHTML = "";
				document.getElementById("emailErr2").innerHTML = "";
				/* document.getElementById("emailErr3").innerHTML = ""; */
				document.getElementById("emailErr4").innerHTML = "";
				document.getElementById("emailErr5").innerHTML = "";
				document.getElementById("emailErr6").innerHTML = "";
				document.getElementById("emailErr7").innerHTML = "";
				document.getElementById("emailErr8").innerHTML = "";
				document.getElementById("emailErr9").innerHTML = "";
				document.getElementById("emailErr10").innerHTML = "";
		
		
			});
			$('#optionsRadios1').click(function(e) {
				document.getElementById("max").value = 1;
				check1 = 1;
				check2 = 1;
				/* check3 = 1; */
				check4 = 1;
				$('#teamno').attr('disabled', true);
				$('#teamname').attr('disabled', true);
				/* $('#teamemail').attr('disabled', true); */
				$('#max').attr('disabled', true);
		
		
			});
			$('#optionsRadios2').click(function(e) {
				check1 = 0;
				check2 = 0;
				/* check3 = 0; */
				check4 = 0;
				document.getElementById("max").value = "";
				$('#teamno').attr('disabled', false);
				$('#teamname').attr('disabled', false);
			/* 	$('#teamemail').attr('disabled', false); */
				$('#max').attr('disabled', false);
		
		
			});
		</script>
</body>

</html>